<template>
  <div id="personal_head">
    <div class="personal_head_left">
      个人主页
    </div>
    <div class="personal_head_right">
      <img :src="userImg"/>
      <div class="head_right_mask" @click="goLogin">
        退出登录
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "PersonalHead",
  props:{
    userImg:{
      type:String,
    },
  },
  methods:{
    goLogin(){
      localStorage.removeItem('JinBookProFront');
      localStorage.removeItem("jin_book_pro_user_img");
      this.$router.push('/');
    }
  }
}
</script>

<style scoped>
#personal_head{
  position: relative;
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 60px;
  /*background: linear-gradient(to left, lightcoral, #8CA3D7);*/
  background-image: linear-gradient( -135deg, #ABDCFF 10%, #0396FF 100%);
  border-radius: 15px;
  overflow: hidden;
}
.personal_head_left{
  font-size: 17px;
  line-height: 58px;
  font-weight: bold;
  border-bottom: 2px solid darkred;
  width: 120px;
  text-align: center;
  color: #ffffff;
}
.personal_head_right{
  position: relative;
  width: 55px;
  height: 100%;
}
.personal_head_right img{
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  width: 55px;
  height: 55px;
  border-radius: 50%;
}

.head_right_mask{
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.5);
  z-index: 3;
  color: #ffffff;
  font-size: 20px;
  text-align: center;
  padding-top: 2px;
  cursor: pointer;
}
.personal_head_right:hover .head_right_mask{
  display: block;
}
</style>
